#include "sensorthread.h"
#include "gpio.h"

SensorThread::SensorThread( QObject *parent ) :
	QThread( parent )
{
	// Test Pin 3 (GPIO_139)
	GPIO::open( 139 );
	GPIO::direction( 139, GPIO_OUT );
	GPIO::write( 139, true );
}

SensorThread::~SensorThread()
{
	GPIO::close( 139 );
}

void SensorThread::run()
{
	bool toggle = false;
	while( true )
	{
		// Toggle GPIO_139 at half second interval
		GPIO::write( 139, toggle );
		toggle = !toggle;
		QThread::msleep( 500 );
	}
}
